import lombok.val;
import org.junit.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class InfoImpl implements Info<Integer>{
    @Override
    public Integer info(Integer var) {
        return var;
    }

    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Class<? extends InfoImpl> clazz = InfoImpl.class;
        Method[] methods = clazz.getDeclaredMethods();
        for (Method method : methods) {
            System.out.println(method.getName() + "返回类型:" + method.getReturnType().getSimpleName());
        }
        InfoImpl info = new InfoImpl();

        Method m1 = clazz.getMethod("info", Object.class);
        Object result = m1.invoke(new InfoImpl(), 123);
        System.out.println(result);

    }

    public static <T> T getMiddle(T... a){
        return a[a.length/2];
    }

//    class MyThrowable<T extends Throwable > extends  Throwable{
//
//        //Generic class may not extend 'java.lang.Throwable'
//
//    }
}



